package atom.core0.util;

import java.math.BigDecimal;

public class MyBigDecimal extends BigDecimal
{

	public MyBigDecimal(String val) {
	    super(val);
    }
	public MyBigDecimal(double val) {
		super(String.valueOf(val));
    }

	public  MyBigDecimal multiply(double d2)
	{
		String s2 = String.valueOf(d2);
		BigDecimal b2 = new BigDecimal(s2);
		BigDecimal bb = this.multiply(b2);
		return new MyBigDecimal(bb.toString());
	}	
	

	
	public  MyBigDecimal divide(double d2,int scale)
	{

		String s2 = String.valueOf(d2);

		BigDecimal b2 = new BigDecimal(s2);

		BigDecimal bb =this.divide(b2,scale,BigDecimal.ROUND_HALF_UP); 
		return new MyBigDecimal(bb.toString());
	}	
	public  MyBigDecimal divide(double d2)
	{

		String s2 = String.valueOf(d2);

		BigDecimal b2 = new BigDecimal(s2);

		BigDecimal bb = this.divide(b2,2,BigDecimal.ROUND_HALF_UP); 
		return new MyBigDecimal(bb.toString());
	}	
	public  MyBigDecimal add(double d2)
	{
		String s2 = String.valueOf(d2);
		BigDecimal b2 = new BigDecimal(s2);
		BigDecimal bb = this.add(b2); 
		return new MyBigDecimal(bb.toString());
	}	
	public  MyBigDecimal subtract(double d2)
	{
		String s2 = String.valueOf(d2);
		BigDecimal b2 = new BigDecimal(s2);
		BigDecimal bb = this.subtract(b2); 
		return new MyBigDecimal(bb.toString());
	}	
}
